package ldh.im.fxbase.data.pojo.status;

import ldh.rpc.dto.ValueEnum;
import ldh.im.dto.enums.SexEnum;

public enum ImSexEnum implements ValueEnum<Byte> {
    male(1, "男性"),
    female(2, "女性"),
    ;

    private Byte aByte;
    private String desc;

    private ImSexEnum(Integer value, String desc) {
        aByte = value.byteValue();
        this.desc = desc;
    }

    @Override
    public Byte getValue() {
        return aByte;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    public static ImSexEnum getByValue(byte value) {
        for(ImSexEnum sexEnum : ImSexEnum.values()) {
            if (sexEnum.getValue().byteValue() == value) {
                return sexEnum;
            }
        }
        throw new RuntimeException("ImSexEnum不支持此值， value=" + value);
    }

    public static ImSexEnum wrap(SexEnum sexEnum) {
        if (sexEnum == null) {
            return null;
        }
        return ImSexEnum.valueOf(sexEnum.name());
    }

}
